home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / c_news / 16 / sets / setsourc / setequ.c < prev    next >
C/C++ Source or Header  |  1989-03-09  |  841b  |  30 lines

  1. #include <stdio.h>
  2. #include <stdarg.h>
  3. #include "sets.h"
  4. /***************************************************************************/
  5.      boolean set_equality(set *left, set *right)
  6. /***************************************************************************/
  7. /* Two sets are equal if they have the same type and size and the identical
  8.    membership.
  9. */
  10. {
  11. int i;
  12.  
  13.     /* check base_type, tags, and set_size */
  14.     if(check_set_types(left,right) == FAILURE)
  15.         return FALSE;
  16.  
  17.     /* If each word of left equals the corresponding word of right, then the
  18.        sets are equal.  Note that each set will have ALL bits at member
  19.        locations higher than nmembers reset to zero.
  20.     */
  21.     for(i=0;i<left->member_recs;i++)
  22.         if(left->word[i] != right->word[i])
  23.             return FALSE;
  24.  
  25.     /* done. */
  26.     return TRUE;
  27.  
  28. }  /* end set_equality */
  29.  
  30.